import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

import java.io.File;

/**
 * @author kongwg
 * @create 2021-01-20 21:11
 */
public class JsoupTest2 {

    public static void main(String[] args) throws Exception{
        String path = ClassLoader.getSystemClassLoader().getResource("student.xml").getPath();
        Document document = Jsoup.parse(new File(path), "utf-8");
        Elements student = document.getElementsByTag("student");
        System.out.println(student);

        System.out.println("_________________");

        Elements name_age = document.select("age");

        System.out.println(name_age);

        System.out.println("----------------------");
        Elements id = document.getElementsByAttribute("number" );
        System.out.println(id);

        System.out.println("----------------------");


        Elements select = document.select("[number='heima_2222']");
        System.out.println(select);


        Elements value = document.getElementsByAttributeValue("number", "heima_1111");
        System.out.println(value);

    }
}
